<?php
require_once 'Login.php';
require_once 'Kanedo/Controller/Abstract.php';
class indexController extends Kanedo_Controller_Abstract 
{
	protected $login;
	public function init()
	{
		/**
		 * Alle Controller des Adminmoduls muessen das haben:
		 */
		$this->login = new Login(Kanedo_Registry::getInstance()->db);
		
		if(!$this->login->isLoggedIn())
		{
			header("Location:http://".$_SERVER['HTTP_HOST'].$this->_request->getBaseUrl()."admin/login");
		}
		
		
		/**
		 * Init View
		 */
		$this->_view->page = new ArrayObject();
		$this->_view->page['title'] = "Dashboard";
		$this->_view->page['css'] = '<link href="/CSS/admin/style-index.css" rel="stylesheet" type="text/css" media="all" />';
		$this->_view->page['javascript'] = '<script type="text/javascript" src="/JS/headline_rotate.js"></script>
											<script type="text/javascript" src="/JS/help.js"></script>';
		
		$this->_view->user = $this->login->getCurrentUser();
	}
	public function indexAction()
	{
		
	}
	
	public function treeAction()
	{
		$this->_view->page['title'] = "Seitenbaum";
		$tree = Kanedo_Registry::getInstance()->tree;
		try {
			$this->_view->tree = $tree->getHTMLTree();
		}catch(Kanedo_Db_Exception $e)
		{
			echo "Keine Daten!";
		}
	}
}
?>